<div id="thumbnails1" >
    <div class="search">
        <form id="filter-form" class="form-inline" action="{:U('Attachment/filelist')}" method="post">
            <div class="form-group">
                <input type="text" name="start_time" class="laydate-icon form-control" id="start" value="{$start_time}" style="width:200px;">
            </div>
            <div class="form-group">
                -
            </div>
            <div class="form-group">
                <input type="text" name="end_time" class="laydate-icon form-control" id="end" value="{$end_time}" style="width:200px;">
            </div>
            <input class="btn btn-primary" type="submit" value="搜索">
        </form>
    </div>

    <ul class="attachment-list">
        <volist name="list" id="vo" key="k">
        <li id="attachment_{$vo[aid]}">
            <div class="img">
                <a href="javascript:void(0);" id="on_{$vo[aid]}" onclick="javascript:add_file(this,{$vo['aid']},{$vo['status']})" class="imgx">
                    <div class="icon"></div>
                    <img src="{$vo['thumb']}" path="{$vo['filepath']}" alt="{$vo['filename']}" imgid="{$vo[aid]}" imgsize="{$vo[filesize]}">
                </a>
                <p>{$vo.filename}</p>
            </div>
            <div class="delete_btn">
                <a href="javascript:confirm_delete({$vo['aid']})">
                    <img src="__PUBLIC__/images/close.png" >
                </a>
            </div>
        </li>
        </volist>
    </ul>
</div>
<div class="pagination" style="margin:18px 0;">{$page}</div>
<script type="text/javascript">
    var start = {
        elem: '#start',
        format: 'YYYY/MM/DD hh:mm:ss',
//    min: laydate.now(), //设定最小日期为当前日期
        max: '2099-06-16 23:59:59', //最大日期
        istime: true,
        istoday: false,
        choose: function(datas){
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
        }
    };
    var end = {
        elem: '#end',
        format: 'YYYY/MM/DD hh:mm:ss',
        min: laydate.now(),
        max: '2099-06-16 23:59:59',
        istime: true,
        istoday: false,
        choose: function(datas){
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start);
    laydate(end);
    $('#filter-form').submit(function() {
        var start_time = $("input[name='start_time']").val();
        var end_time = $("input[name='end_time']").val();
        var page = 1;
        var typeid = 1;

        $.ajax({
            url: "{:U('Attachment/filelist')}&typeid="+typeid+"&p="+page+"&inputid=filelist",
            type: 'POST',
            data: {start_time: start_time,end_time: end_time},
            success: function(data) {

                $('#fieldlist_li').parent().addClass('on').siblings().removeClass('on');
                $('.tabbox').eq(3).css({display:'block'}).siblings().css({display:'none'});
                $('#filelist').html(data);
            }
        })

        return false;
    });

    // 确认删除
    function confirm_delete(aid){
        var url = '/?a=delfile&m=attachment&g=admin&aid='+aid;
        layer.confirm('确认要删除图片吗?', {icon: 3, title:'提示'}, function(index){
            //do something
            $.ajax({
                url:url,
                success:function(data){
                    if (data.status == 1) {
                        layer.msg(data.info, {icon: 1});
                        $('#attachment_'+aid).remove();
                    } else {
                        layer.msg(data.info, {icon: 2});
                    }
                }
            });
            layer.close(index);
        });
    }
</script>